# Maintainer: Johannes Schindelin <johannes.schindelin@gmx.de>

_realname=xpdf
pkgbase="mingw-w64-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-poppler")
pkgver=3.04
pkgrel=1
pkgdesc="Utilities for PDF files (mingw-w64)"
arch=('any')
license=('GPL2+')
url="http://foolabs.com/xpdf/"
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-freetype" "${MINGW_PACKAGE_PREFIX}-libpng")
options=('strip')
source=("ftp://ftp.foolabs.com/pub/xpdf/xpdf-${pkgver}.tar.gz")
sha256sums=('11390c74733abcb262aaca4db68710f13ffffd42bfe2a0861a5dfc912b2977e5')

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --with-freetype2-includes=$(pkg-config --dont-define-prefix --variable=includedir freetype2)

  make
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}
  make DESTDIR="${pkgdir}" install
}
